package com.lanou.service;

import com.github.pagehelper.PageInfo;
import com.lanou.bean.AdminInfo;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * Created by dllo on 18/3/9.
 */
public interface AdminInfoService {

    /**
     * 登录
     * @param username
     * @param password
     * @return
     */
    AdminInfo login(@Param("username") String username, @Param("password") String password);

    /**
     * 授权,根据username查id
     * @param username
     * @return
     */
    List<AdminInfo> findAdminById(String username);

    /**
     * 查询所有数据
     * @return
     */
    List<AdminInfo> findAllAdmin();

    /**
     * 分页
     * @param pageNo
     * @param pageSize
     * @return
     */
    PageInfo<AdminInfo> queryAdminByPage(Integer pageNo, Integer pageSize);

    /**
     * 添加
     * @param adminCode
     * @param password
     * @param name
     * @param telephone
     * @param email
     * @param rolos
     */
    void addAdmin(String adminCode,String password,String name,String telephone,String email, List<Integer> rolos);

    /**
     * 修改
     * @param admin
     * @param name
     * @param telephone
     * @param email
     * @param adminId
     */
    void updateAdmin(String admin, String name, String telephone, String email, Integer adminId,List<Integer> roles);

    /**
     * 删除
     * @param adminId
     */
    void deleteAdmin(Integer adminId);
    List<AdminInfo> selectAdminRoleByName(String username);

    void updateUserInfo(@Param("name") String name,@Param("telephone") String telephone,@Param("email") String email,@Param("adminCode") String adminCode);

    List<AdminInfo> selectOldPasswordExist(@Param("password") String password,@Param("adminCode") String adminCode);

    void updatePassword(@Param("password") String password,@Param("adminCode") String adminCode);

    void resetpass(List<Integer> admins);
}
